﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Convertor.Interface;

namespace Convertor.Plugin.InputAndOutput
{
    /// <summary>
    /// ConfigForm.xaml 的交互逻辑
    /// </summary>
    public partial class ConfigForm : PluginConfigForm
    {

        public ConfigForm()
        {
            InitializeComponent();
        }

        #region IPluginConfig 成员

        private ConfigContent config;
        public override object Config
        {
            get { return config ?? new ConfigContent(); }
            set { config = (value as ConfigContent) == null ? new ConfigContent() : (ConfigContent)((ICloneable)value).Clone(); }
        }

        #endregion

        #region IConfigFormEvent 成员

        public override object GetConfig()
        {
            return ((ConfigContent)Config).Clone();
        }

        #endregion

        #region IPluginHistory 成员

        public override object Input { get; protected set; }

        #endregion

        private void CheckBox_Checked(object sender, RoutedEventArgs e)
        {
            CheckBox cb = (CheckBox)sender;
            int f = (int)cb.Tag;
            config.CompareType = (CompareTypes)((int)config.CompareType | f);
        }

        private void CheckBox_Unchecked(object sender, RoutedEventArgs e)
        {
            CheckBox cb = (CheckBox)sender;
            int f = (int)cb.Tag;
            config.CompareType = (CompareTypes)(((int)config.CompareType | f) ^ f);
        }
    }
}
